home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / TPWENG / GETDATE.PAS < prev    next >
Pascal/Delphi Source File  |  1991-07-22  |  936b  |  38 lines

  1. program GetDate;
  2. uses PXEngine, WinCrt;
  3.  
  4. const TableName = 'Table';
  5.  
  6. var   PxErr: Integer;
  7.       TblHandle: TableHandle;
  8.       RecHandle: RecordHandle;
  9.       FldHandle: FieldHandle;
  10.       Month, Day, Year: Integer;
  11.       Date: Longint;
  12.  
  13. procedure PX(Code : integer);
  14. begin
  15.   writeln(PXErrMsg(Code));
  16. end;
  17.  
  18. begin
  19.   PX(PXWinInit('MyApp', pxShared));
  20.   PX(PXTblOpen(TableName, TblHandle, 0, False));
  21.   PX(PXRecBufOpen(TblHandle, RecHandle));
  22.   PX(PXFldHandle(TblHandle, 'Date Field', FldHandle));
  23.   PX(PXRecGet(TblHandle, RecHandle));
  24.  
  25.   (* Get a date field out of a record buffer *)
  26.   PxErr := PXGetDate(RecHandle, FldHandle, Date);
  27.   if PxErr <> PxSuccess then
  28.     Writeln(PxErrMsg(PxErr))
  29.   else begin
  30.        PX(PXDateDecode(Date, Month, Day, Year));
  31.        Writeln('Date: ', Month, '/', Day, '/', Year);
  32.        end;
  33.  
  34.   PX(PXRecBufClose(RecHandle));
  35.   PX(PXTblClose(TblHandle));
  36.   PX(PXExit);
  37. end.
  38.